package com.xmfh.wemedia.controller;

import com.xmfh.wemedia.model.DdArticle;
import com.xmfh.wemedia.service.IDdIndexService;
import com.xmfh.wemedia.util.JsonResult;
import com.xmfh.wemedia.vo.MicroVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Auther: 胡桃
 * @Date: 2022/4/9 14:48
 * @Description: com.xmfh.wemedia.controller
 * @version: 1.0
 */
@RestController
@RequestMapping("/wemedia/index")
public class DdIndexController {
    @Autowired
    private IDdIndexService indexService;

    @RequestMapping("/{navType}/listAll")
    public JsonResult<List<MicroVO>> listAllByNav(@PathVariable String navType) {
        return indexService.listMicro(navType);
    }

    @RequestMapping("/{navType}/listAll/{parameter}")
    public JsonResult<List<DdArticle>> searchByRegion(@PathVariable String navType, @PathVariable String parameter) {
        System.out.println(parameter);
        return indexService.listArticleByCondition(navType, parameter);
    }
}
